package slidingpenguins.slideshow.model {

	public final class Distance {
		public static const DISTANCE_UNIT_AUTO:uint = 0;
		public static const DISTANCE_UNIT_PIXELS:uint = 1;
		public static const DISTANCE_UNIT_PERCENTAGE:uint = 2;

		private var _unit:uint;
		private var _value:Number;

		public function get unit():uint {
			return _unit;
		}

		public function get value():Number {
			return _value;
		}

		public function Distance(value:Number, unit:uint = Distance.DISTANCE_UNIT_PIXELS) {
			_unit = unit;

			if (unit == Distance.DISTANCE_UNIT_AUTO) {
				_value = 0;
			} else {
				_value = value;
			}
		}
		
		public function toString():String {
			if (unit == DISTANCE_UNIT_AUTO) {
				return "auto";
			} else if (unit == DISTANCE_UNIT_PIXELS) {
				return "" + value;
			} else {
				return "" + value + "%";
			}
		}		
	}
}
